package com.supermap.originTest;


import com.supermap.data.*;


public class TestHoleArea {

    /**
     * 程序入口点
     * The entrance of the programme.
     */
    public static void main(String[] args) {


		
		Workspace m_workspace = new Workspace();
		WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo(
				"E:\\\\MapData\\\\202403\\\\Workspace.smwu");
		conInfo.setType(WorkspaceType.SMWU);
		m_workspace.open(conInfo);


		Datasource datasource =m_workspace.getDatasources().get(0);
		DatasetVector datasetVector = (DatasetVector)datasource.getDatasets().get("QueryResult_1");
//		dataset
		Geometry geo1 = datasetVector.getAllFeatures().get(1).getGeometry();
		Geometry geo2 = datasetVector.getAllFeatures().get(2).getGeometry();
		Geometry geo3 = datasetVector.getAllFeatures().get(3).getGeometry();
		System.out.println(Toolkit.GeometryToWKT(geo1));
		if(geo1 instanceof GeoRegion){
			System.out.println(((GeoRegion)geo1).getPreciseArea(PrjCoordSys.fromEPSG(4490)));
			System.out.println(new GeoRegion(((GeoRegion)geo1).getPart(0)).getPreciseArea(PrjCoordSys.fromEPSG(4490)));
			System.out.println(new GeoRegion(((GeoRegion)geo1).getPart(1)).getPreciseArea(PrjCoordSys.fromEPSG(4490)));
		}

		geo1.dispose();
		datasource.close();

		m_workspace.close();
		m_workspace.dispose();



	}



}  

